<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			
			$.fn.editable.defaults.emptytext='空';
			
			
			$(function(){

				$('.crm_real_name').editable({
					   url: '<?php echo base_url().'crm/user/edit_real_name'?>',
					   type: 'text',
					   name: 'crm_real_name',
					   title: '输入真实姓名',
					   success: function(response, newValue) {
							if(response.error==1){
								return response.msg;
							}
					   },
					   validate: function(value) {
							if($.trim(value) == '') {
								return '不能为空';
							}
						}
				});
				
				
				$('.crm_weixin').editable({
					   url: '<?php echo base_url().'crm/user/edit_weixin'?>',
					   type: 'text',
					   name: 'crm_weixin',
					   title: '输入微信号',
					   success: function(response, newValue) {
							if(response.error==1){
								return response.msg;
							}
					   },
					   validate: function(value) {
							if($.trim(value) == '') {
								return '不能为空';
							}
						}
				});
				
					
					
					
				$('.crm_nature').editable({
									
									source: <?php echo json_encode(get_user_nature());?>
				});
				
						
				$('.crm_server_user').editable({
									
									source: <?php echo $server_user;?>
				});
				
			
			
			})

			
		</script>

		<ul class="breadcrumb">
			<li class="active">
				<i class="icon-home home-icon"></i>
				<a href="#">系统首页</a>
			</li>
			<li class="active">
				数据管理
			</li>
			<li class="active">
				客户列表
			</li>
		</ul><!-- .breadcrumb -->
	</div>

	<div class="page-content">
		<div class="row">
			<div class="page-header">
				<h1>订单列表</h1>
			</div>
            <div class="col-xs-12">
			
	        </div>
	        <div class="col-md-12 col-sm-12 col-xs-12 form">
	        <form action="<?php echo base_url().'crm/user/index'?>" method="get">
	        	<div class="row">
	        	  
				  	
					<div class="wh" style="width:240px;">
                    	<label>手机号：</label>
                    	<input type="text" name="phone" value="<?php echo $phone?>" />
                    </div>
				  
                    <div class="wh" style="width:170px;">
                    	<label>客户状态：</label>
                    	<select name="user_status" id="user_status">
                            <option value="">全部</option>
							<option value="1"  <?php if($user_status==1):?>selected="selected"<?php endif;?>>加油用户</option>
							<option value="2" <?php if($user_status==2):?>selected="selected"<?php endif;?>>分享用户</option>
						</select>
                    </div>
					
					<div class="wh" style="width:170px;">
                    	<label>客户性质：</label>
                    	<select name="user_nature" id="user_nature">
                            <option value="">全部</option>
							<?php foreach($user_nature as $v):?>
							<option value="<?php echo $v['value']?>" <?php if(!empty($_GET['user_nature'])&&$_GET['user_nature']==$v['value']):?>selected="selected"<?php endif;?>><?php echo $v['text']?></option>
							<?php endforeach;?>
							
						</select>
                    </div>
                    
					<div class="wh"  style="width:170px;">
                	<label>车贴审核：</label>
                    	<select name="car_status" id="car_status" style="height: 23px;">
                    		<option value="">全部</option>
                    		<option value="1" <?php if (isset($car_status)&&$car_status == '1')echo "selected";?>>已审核</option>
                    		<option value="0" <?php if (isset($car_status)&&$car_status == '0')echo "selected";?>>未审核</option>
                    		
                    	</select>
                    </div>
					
					<div class="wh"  style="width:270px;">
                	<label>加油次数：</label>
						<select name="condition" >
							<option value="">全部</option>
							<option value="1" <?php if (isset($condition)&&$condition == '1')echo "selected";?>>等于</option>
							<option value="2" <?php if (isset($condition)&&$condition == '2')echo "selected";?>>大于</option>
						</select>
                    	<input type="text" name="gas_count" value="<?php if (isset($gas_count))echo $gas_count;?>"  style="width:30px;" /> 次
                    </div>

					
					
					<div class="wh"  style="width:270px;">
                	<label>加油油站：</label>
                    	<select name="gas_id" id="gas_id" style="height: 23px;">
                    		<option value="">全部</option>
                    		<?php foreach($gasstation as $v):?>
                    		<option value="<?php echo $v['id'];?>" <?php if (isset($gas_id)&&$gas_id ==$v['id'])echo "selected";?>><?php echo $v['gasstation_name']?></option>
                    		<?php endforeach;?>
                    	</select>
                    </div>
                    <br />
                    <div class="col-xs-4 sell_btn">
    	        	<button class="btn btn-sm btn-info" type="submit"><i class="icon-search"></i>查询</button>
    	        	
	                </div>     
	            </div>
	            
	        </div>
	        
	        </form>

        	<div class="col-xs-12 margin_t margin_b">
				<div class="table-responsive  tab">
				<form action="<?php echo base_url()."admin/order/del_some"?>" method="post" id="delForm">
					<table id="sample-table-1" class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								
								<th>用户编号</th>
                                <th>手机号码</th>
								<th>客户名称</th>
								<th>客户微信</th>
								<th>客户性质</th>
								<th>客户负责人</th>
								<th>客户状态</th>
                                <th>已付款订单</th>
								<th>加油次数</th>
								<th>最近付款时间</th>
								<th>车贴审核</th>
                                
							</tr>
						</thead>

						<tbody>
							<?php if (isset($result)&&count($result)>0){
                            	foreach ($result as $app){
                            	?>
							<tr>
								
								<td><p><?php  echo $app->id;?></p></td>
								<td><p><?php  echo $app->login_name?></p></td>
								<td>
									<p>
									<a href="###"  data-type="text" data-pk="<?php echo $app->id?>" data-title="输入真实姓名" class="editable editable-click crm_real_name"><?php if($app->crm_real_name){echo $app->crm_real_name;}else{echo '未设置';}?></a>
									</p>
								</td>
								
								<td>
									<p>
									<a href="###"  data-type="text" data-pk="<?php echo $app->id?>" data-title="输入微信号" class="editable editable-click crm_weixin"><?php if($app->crm_weixin){echo $app->crm_weixin;}else{echo '未设置';}?></a>
									</p>
								</td>
								
								<td>
									<p>
									<a href="###"  id="crm_nature_<?php echo $app->id?>" data-type="select" data-value="<?php echo $app->crm_nature?>"  data-url="<?php echo base_url().'crm/user/edit_nature'?>" data-pk="<?php echo $app->id?>" data-title="选择客户性质" class="editable editable-click crm_nature"><?php if($app->crm_nature){echo user_nature($app->crm_nature);}else{echo '未设置';}?></a>
									</p>
								</td>
								
								
								<td>
									<p>
									<a href="###"  id="crm_server_user_<?php echo $app->id?>" data-type="select" data-url="<?php echo base_url().'crm/user/edit_server_user'?>" data-pk="<?php echo $app->id?>" data-title="选择负责人" data-value="<?php if(empty($app->crm_server_user)){echo '未分配';}else{echo $app->crm_server_user;}?>" class="editable editable-click crm_server_user"><?php if(empty($app->crm_server_user)){echo '未分配';}else{echo $app->crm_server_user;}?></a>
									</p>
								</td>
								
								<td>
								<p>
									<?php if(!empty($app->hasinvite)){echo '分享用户';}elseif($app->order_count>0){echo '加油用户';}else{echo '注册用户';}?>
								</p>
								</td>
								
								
								
							
								<td><p><a href="<?php echo base_url().'crm/order/query?user_phone='.$app->login_name?>" class="editable editable-click"><?php  echo $app->order_count?></a></p></td>
								
								<td><p><?php  echo $app->o_count?></p></td>
								<td><p><?php  echo $app->new_order['create_time']?></p></td>
								
								<td><p><?php if($app->status==='0'):?>未审核<?php elseif($app->status==1):?>已审核<?php else:?>未上传<?php endif;?></p></td>                            
    						</tr>
							
							<script>
								
								
							</script>
							
							
							
    						<?php }
                            }else{?>
                            <tr>
                            	<td colspan="15">无数据</td>
                            </tr>
                            <?php }?>
						</tbody>
					</table>
					
					</form>
				</div><!-- /.table-responsive -->
			</div>
        
        	<div class="col-sm-12">
            	<div class="modal-footer no-margin-top">
                	<div class="pull-left record">
						共<?php echo $count;?>条记录
                    </div>
            		<?php if (isset($page))echo $page;?>
            	</div>
            </div>
		</div><!-- /.row -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
	